#ifndef QEDITORFACTORY_H
#define QEDITORFACTORY_H

#include "../../lib/corelib/qnamevalidator.h"

#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
#include <QComboBox>
#include <QToolButton>

#include <QDateTimeEdit>
#include <QTimeEdit>
#include <QDateEdit>

class QProperty;
class QScriptEditDialog;

class QSpinBoxEditor: public QSpinBox
{
    Q_OBJECT
public:
    QSpinBoxEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void setPropertyValue();
    void propertyValueChanged();
protected:
    QProperty   *m_property;
};

class QDoubleSpinBoxEditor: public QDoubleSpinBox
{
    Q_OBJECT
public:
    QDoubleSpinBoxEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void setPropertyValue();
    void propertyValueChanged();
protected:
    QProperty   *m_property;
};

class QLabelEditor: public QWidget
{
    Q_OBJECT
public:
    QLabelEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void propertyValueChanged();
protected:
    QProperty   *m_property;
    QLabel      *m_icon;
    QLabel      *m_text;
};

class QByteEditor: public QLineEdit
{
    Q_OBJECT
public:
    QByteEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void setPropertyValue();
    void propertyValueChanged();
protected:
    QProperty   *m_property;
};


class QNameLineEditor: public QNameEdit
{
    Q_OBJECT
public:
    QNameLineEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void setPropertyValue();
    void propertyValueChanged();
protected:
    QProperty   *m_property;
};

class QBoolEditor: public QCheckBox
{
    Q_OBJECT
public:
    QBoolEditor(QProperty* property,QWidget *parent=0);
protected:
    void    mousePressEvent(QMouseEvent *e);
protected slots:
    void propertyValueChanged();
    void setPropertyValue();
protected:
    QProperty   *m_property;
};

class QFontFamilyEditor: public QComboBox
{
    Q_OBJECT
public:
    QFontFamilyEditor(QProperty* property,QWidget *parent=0);
protected slots:
    void propertyValueChanged();
    void setPropertyValue(QString family);
protected:
    QProperty   *m_property;
};

class QFontEditor: public QLabelEditor
{
    Q_OBJECT
public:
    QFontEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void showFontDialog();
protected:
    QProperty   *m_property;
    QToolButton *m_button;

};

class QEnumEditor: public QComboBox
{
    Q_OBJECT
public:
    QEnumEditor(QProperty* property,QWidget *parent=0);
protected slots:
    void propertyValueChanged();
    void setPropertyValue(int value);
protected:
    QProperty   *m_property;
};

class QCursorEditor: public QComboBox
{
    Q_OBJECT
public:
    QCursorEditor(QProperty* property,QWidget *parent=0);
protected slots:
    void propertyValueChanged();
    void setPropertyValue(int value);
protected:
    QProperty   *m_property;
};

class QComboItemEditor: public QLabelEditor
{
    Q_OBJECT
public:
    QComboItemEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void showFontDialog();
protected:
    QProperty   *m_property;
    QToolButton *m_button;
};

class QTimeEditor: public QTimeEdit
{
    Q_OBJECT
public:
    QTimeEditor(QProperty* property,QWidget *parent=0);
protected slots:
    void propertyValueChanged();
    void setPropertyValue();
protected:
    QProperty   *m_property;

};

class QDateEditor: public QDateEdit
{
    Q_OBJECT
public:
    QDateEditor(QProperty* property,QWidget *parent=0);
protected slots:
    void propertyValueChanged();
    void setPropertyValue();
protected:
    QProperty   *m_property;

};

class QDateTimeEditor: public QDateTimeEdit
{
    Q_OBJECT
public:
    QDateTimeEditor(QProperty* property,QWidget *parent=0);
protected slots:
    void propertyValueChanged();
    void setPropertyValue();
protected:
    QProperty   *m_property;

};

class QColorEditor: public QLabelEditor
{
    Q_OBJECT
public:
    QColorEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void showColorDialog();
protected:
    QProperty   *m_property;
    QToolButton *m_button;
};

class QBorderEditor: public QLabelEditor
{
    Q_OBJECT
public:
    QBorderEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void showBorderDialog();
protected:
    QProperty   *m_property;
    QToolButton *m_button;
};


class QImageEditor: public QLabelEditor
{
    Q_OBJECT
public:
    QImageEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void showImageDialog();
protected:
    QProperty   *m_property;
    QToolButton *m_button;
};

class QMemeryValueEditor: public QLabelEditor
{
    Q_OBJECT
public:
    QMemeryValueEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void showMemeryValueDialog();
protected:
    QProperty   *m_property;
    QToolButton *m_button;
};

class QScriptEditor: public QLabelEditor
{
    Q_OBJECT
public:
    QScriptEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void showScriptEditDialog();

    void    scripteChanged(const QString &script);
protected:
    QProperty   *m_property;
    QToolButton *m_button;
    QScriptEditDialog   *m_edit;
};

class QPaddingEditor: public QLabelEditor
{
    Q_OBJECT
public:
    QPaddingEditor(QProperty* property,QWidget *parent=0);

protected slots:
    void showPaddingEditDialog();
protected:
    QProperty   *m_property;
    QToolButton *m_button;
};

#endif // QEDITORFACTORY_H
